<?php

$type= $_POST['type'];

if($type=='getusername'){
    session_start();
    echo $_SESSION['username'];
    exit(1);
}

if($type=='msgnum'){
    include '../../config/database.php';
    include "../../config/database.php";

    $con = mysqli_connect($dbhost,$dbuser,$dbpasswd,$dbname);

    $sqlname = $dbprefix.'messages';

    $Query = 'Select count(*) as AllNum from '.$sqlname;
    $a     = mysqli_query( $con, $Query );
    $b     = mysqli_fetch_assoc( $a );
    echo $b['AllNum'];
    
}

?>